// Package main provides ...
package main

import (
	"fmt"
)

//字符串长度即底层字节序列中，字节的个数
func main() {
	printString()
}

func printString() {
	s := "hello,世界" //UTF8编码的字符串
	println(len(s))
	fmt.Printf("%#v\n", s)
	fmt.Printf("length:%d,Unicode码点:%#v\n", len(s), []byte(s))
	//tip: 遍历原始字节码。不解码UTF8字符串，使用[]byte将字符串强制转为字节序列
	for i, v := range []byte(s) {
		fmt.Printf("index:s[%d],value:%#v\n", i, v)
	}

}
